﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using yiwei.Repository.Entity;

namespace yiwei.Repository.EntityConfig
{
   public class RoleMap : IEntityTypeConfiguration<Role>
    {
        public void Configure(EntityTypeBuilder<Role> builder)
        {
            builder.ToTable("Role");
            builder.HasKey(c => c.Id);
            builder.Property(b => b.Name).HasColumnType("varchar(200)").IsRequired();
            builder.HasIndex(b => b.Name).IsUnique().HasName("Index_Name"); //唯一索引·
            builder.Property(b => b.Description).HasColumnType("varchar(200)").IsRequired();
           

        }
    }
}
